package cn.wolfcode.crm.service.impl;

import cn.wolfcode.crm.domain.Compensationinfo;
import cn.wolfcode.crm.mapper.CompensationinfoMapper;
import cn.wolfcode.crm.query.CompensationInfoQueryObject;
import cn.wolfcode.crm.query.QueryObject;
import cn.wolfcode.crm.service.ICompensationInfoService;
import cn.wolfcode.crm.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class CompensationInfoServiceImpl implements ICompensationInfoService {
    @Autowired
    private CompensationinfoMapper compensationInfoMapper;

    public void insert(Compensationinfo record)
    {
/*
        Long accident_id = record.getAccident().getId();
*/
       // this.compensationInfoMapper.deleteByCaseInfoId(accident_id);
        this.compensationInfoMapper.insert(record);
    }

    public Compensationinfo selectByPrimaryKey(Long id)
    {
        return this.compensationInfoMapper.selectByPrimaryKey(id);
    }

    public List<Compensationinfo> selectAll()
    {
        return this.compensationInfoMapper.selectAll();
    }

    public void updateByPrimaryKey(Compensationinfo record)
    {
        this.compensationInfoMapper.updateByPrimaryKey(record);
    }


    public PageResult query(CompensationInfoQueryObject qo)
    {
        int total = this.compensationInfoMapper.queryCount(qo);
        if (total > 0) {
            List rows = this.compensationInfoMapper.queryList(qo);
            return new PageResult(total, rows);
        }
        return new PageResult(0, Collections.EMPTY_LIST);
    }


    public Compensationinfo selectByAid(Long aid)
    {
        return this.compensationInfoMapper.selectByAid(aid);
    }

    public void deleteByPrimaryKey(Long id)
    {
        this.compensationInfoMapper.deleteByPrimaryKey(id);
    }
}
